package com.zl.controller;

import com.zl.entity.po.Stu;
import com.zl.service.StuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author zhanglei2
 * @since 2019/12/11 17:55
 */
@Controller
public class UserController {
    @Autowired
    private StuService stuService;
    @RequestMapping("/getList")
    public String getList(Model model){
            List<Stu> list = stuService.getStuList();
            model.addAttribute("list",list);
            return "/list";
    }
    @RequestMapping("/insert")
    public String insert(Stu stu){
        String s = stuService.insert(stu);
        return "redirect:/getList";
    }
}
